#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n = 0;
    cin >> n;
    vector<int> v(n, 0);
    for (int i = 0;i < n;i++)
    {
        cin >> v[i];
    }
    int max = 0;
    int count = 1;
    for (int i = 1;i < n;i++)
    {
        if (v[i] - v[i - 1] > 8)
        {
            if (count > max)
            {
                max = count;
            }
            count = 0;
        }
        ++count;
    }
    if (count > max) max = count;
    cout << max << endl;
    return 0;
}
